/**
 * 格式化日期
 * 年-月-日 时:分:秒
 */
export function formatDate(date) {
    if (!date) {
      date = new Date();
    }
    if (typeof date === "string") {
      date = new Date(date);
    }
    if (typeof date === "number") {
        date = new Date(date);
      }
    //   console.log(date);
    let year = date.getFullYear();
    let mon = date.getMonth() + 1;
    if (mon < 10) {
      mon = "0" + mon;
    }
    let day = date.getDate();
    if (day < 10) {
      day = "0" + day;
    }
    let h =date.getHours();
    if(h<10){
        h="0"+h
    }
    let m = date.getMinutes();
    if(m<10){
        m='0'+m
    }
    let s = date.getSeconds();
    if(s<10){
       s='0'+s
    }
    return year + "-" + mon + "-" + day +' '+h+':'+m+':'+s;
  }